class CUSTOM_LIST(list):
	"""
	"""
	def __init__(self):
		"""
		"""
		list.__init__(self)

	def append(self, val):
		list.append(self, val)

	def extend(self, vals):
		list.extend(self, vals)

	def insert(self, index, val):
		list.insert(self, index, val)

	def pop(self, index = -1):
		list.pop(self, index)

	def remove(self, val):
		list.remove(self, val)

	def clear(self):
		list.clear()

	def reverse(self):
		list.reverse(self)

	def sort(cmp = None, key = None, reverse = False):
		list.sort(cmp, key, reverse)

	def asDict(self):
		dictData = {
			"elem": [],
		}

		for val in self:
			data = {
				"type"		: IKernel.Instance().getDataStringType(val),
				"val"		: str(val),
			}
			dictData["elem"].append(data)
		return dictData

	def createFromDict(self, dictData):
		for data in dictData["elem"]:
			strType = data["type"]
			if strType == "STRING" or strType == "UNICODE":
				self.append(data["val"])
			elif strType == "FLOAT" or strType == "DOUBLE":
				self.append(float(data["val"]))
			else:
				self.append(int(data["val"]))

		return self

class CUSTOM_LIST_PICKLER:
	def __init__(self):
		pass

	def createObjFromDict(self, dict):
		return CUSTOM_LIST().createFromDict(dict)

	def getDictFromObj(self, obj):
		return obj.asDict()

	def isSameType(self, obj):
		return isinstance(obj, CUSTOM_LIST)

inst = CUSTOM_LIST_PICKLER()